package com.sky.controller.admin;

import com.sky.result.Result;
import com.sky.service.ShopService;
import com.sky.vo.ShopVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
public class ShopController {


    @Autowired
    private ShopService shopService;


    // 获取商家信息
    @GetMapping("/user/shop/getMerchantInfo")
    public Result getMerchantInfo(){
        log.info("获取商家信息");
        ShopVO shopVO = shopService.getMerchantInfo();
        return Result.success(shopVO);
    }

    // 设置营业状态
    @PutMapping("/admin/shop/{status}")
    public Result setShopStatus(@PathVariable Integer status){
        log.info("设置营业状态,接收到的参数是{}",status);
        shopService.setShopStatus(status);
        return Result.success();
    }

    // 管理端营业状态
    @GetMapping("/admin/shop/status")
    public Result manageShopStatus(){
        log.info("管理端营业状态");
        Integer status =  shopService.manageShopStatus();
        return Result.success(status);
    }

    // 用户端营业状态
    @GetMapping("/user/shop/status")
    public Result manageUserStatus(){
        log.info("用户端营业状态");
        Integer status = shopService.manageUserStatus();
        return Result.success(status);
    }
}
